package com.weixing.mall.provider.controller.admin;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.provider.model.dto.GoodsParamDto;
import com.weixing.mall.provider.model.dto.GoodsParamSaveDto;
import com.weixing.mall.provider.service.IGoodsParamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author wx
 * @Date 2019/10/24 11:25
 * @Version 1.0
 */
@RestController
@RequestMapping("goodsParam")
@Api(value = "商品参数管理API",tags = "商品参数管理")
public class GoodsParamController {
    @Autowired
    private IGoodsParamService goodsParamService;

    @ApiOperation("新增")
    @PostMapping("save")
    public Result save(@RequestBody GoodsParamSaveDto goodsParamDto){
        goodsParamService.save(goodsParamDto.getGoodsParamDto(),goodsParamDto.getGoodsId());
        return ResultUtil.success();
    }
    @ApiOperation(value = "查询参数详情")
    @PostMapping("selectParamByGoodsId/{goodsId}")
    public Result selectParamByGoodsId(@PathVariable Long goodsId){
        return ResultUtil.success(goodsParamService.selectByGoodsId(goodsId));
    }
}
